var queryParam = {"type" : 2};
$(function(){
    getListPage();
});

function getListPage(param){
    param = $.extend(queryParam,param);
    $.ajax({
        type : "post",
        url : "htmlWeb/getDictListByPage",//,"payStatus" : -2
        data: param,
        async: false,
        success : function(data){
            $("#wedEnvironmentPageHead ~ tr").remove();
            var str = "";
            $.each(data.rows,function(i,obj){
                obj = trimEmpty(obj);
                str += '<tr><td><p>' + obj.id + '</p></td>' +
                    '<td><p>' + obj.code + '</p></td>' +
                    '<td><p>' + obj.name + '</p></td>' +
                    '<td><span class="userSpan"><a class="cur" href="javascript:void(0);" onclick="deleteWedEnvironment('+ obj.id + ')">删除</a>' +
                    '<a class="cur" href="javascript:void(0);" onclick="editWedEnvironment('+ obj.id + ')">编辑</a></span></td></tr>';
            });
            $("#wedEnvironmentPageHead").after(str);
            createPage(data);

        },
        error : function(data){
            console.log(data);
        }
    });
}

function deleteWedEnvironment(id){
    $.post("/htmlWeb/deleteDict",{"id" : id},function(){
        tip("删除成功");
        goPage(1);
    });
}
function editWedEnvironment(id) {
    var jsPath = "../../by-webhtml/assets/js/system/system_wedEnvironmentAdd.js";
    $(".mainDiv").load("/htmlWeb/systemWedEnvironmentAddHtml", '', function () {
        $("#wedEnvironmentId").val(id);
        $.getScript(jsPath);
    });
}